﻿create procedure [dbo].[usp_ThreadUpdate]
	@ThreadId int
	, @ConcurrencyId rowversion
	, @IsAlive bit
	, @IsBackground bit
	, @IsThreadPoolThread bit
	, @ManagedThreadId int
	, @Name nvarchar(512)
	, @Priority nvarchar(100)
	, @ThreadState nvarchar(100)
	, @CurrentCulture nvarchar(100)
	, @CurrentUICulture nvarchar(100)
as

begin try
	
	begin transaction
	
		update [dbo].[Thread]
		set
			[IsAlive] = @IsAlive
			, [IsBackground] = @IsBackground
			, [IsThreadPoolThread] = @IsThreadPoolThread
			, [ManagedThreadId] = @ManagedThreadId
			, [Name] = @Name
			, [Priority] = @Priority
			, [ThreadState] = @ThreadState
		where ThreadId = @ThreadId and ConcurrencyId = @ConcurrencyId
		
	commit transaction

end try
	
begin catch
	if @@trancount > 0
	begin
		rollback transaction;
	end
	execute [dbo].[usp_SqlErrorInsert]
end catch


